<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>我要买车</title>
    <link rel="stylesheet" th:href="@{/css/h_PurchaseCar.css}">
    <link rel="stylesheet" th:href="@{/css/h_public.css}">
    <script type="text/javascript" th:src="@{/js/jquery-3.1.1.min.js}"></script>
</head>
<style type="text/css">
    .phone {
        float: right;
        font-family: arial,helvetica,sans-serif;
        width: 162px;
        height: 24px;
        margin-top: 28px;
        color: #22ac38;
        font-weight: 700;
        line-height: 24px;
        text-align: right;
        border-left: 1px solid #888;
        font-size: 24px;
        margin-left: 12px;
    }
    .logout {
        float: right;
        width: 80px;
        height: 24px;
        text-align: right;
        font-size: 16px;
        position : relative;
        top: -30px;
        left: 1200px;
    }
    .dd-option > a:hover {
        background-color: #428675;
        color: white;
    }

    .dd-option > a {
        cursor: pointer;
        font-size: 15px;
    }

    .dd-option > span > a:hover {
        background-color: #428675;
        color: white;
    }

    .dd-option > span > a {
        display: block;
        text-align: center;
        margin: 5px 0;
        color: #888;
        cursor: pointer;
        font-size: 15px;
    }

    .dd-option {
        z-index: 999;
    }
</style>
<body>
<!--头部导航-->
<header class="head">
    <div class="nav">
        <div style="width: 64px;height: 64px;float: left;background-position: -5px;background-image: url(../img/mai1.png);"></div>
        <div class="nav-2">
            <span style="font-size: 14px;color: #888;">天津</span>
            <span style="display: inline-block;width: 11px;height: 6px;background-image: url(img/m-4.png);background-position: -265px -35px;"></span>
        </div>
        <div class="phone">400-060-6046</div>
        <div class="login">
            <a th:if="${#strings.isEmpty(userName) && #strings.isEmpty(userPhone)}" href="http://localhost:9003/user/toLogin">登录</a>
            <a th:if="${not #strings.isEmpty(userName)}" href="#" th:text="${userName}"></a>
            <a th:if="${not #strings.isEmpty(userPhone)}" href="#" th:text="${userPhone}" style="font-size: 10px;margin-left: 15px;"></a>
        </div>
        <div class="nav-nav">
            <a th:href="@{/usedCar/queryUsedCarListHome}">首页</a>
            <a href="#" class="pppp">我要买车</a>
            <a th:href="@{/usedCar/details}">我要卖车</a>
            <!--<a href="#">西瓜服务</a>
            <a href="#">西瓜金融</a>
            <a href="#">毛豆新车</a>
            <a href="#">西瓜问答</a>-->
        </div>
        <div class="logout">
            <a th:if="${not #strings.isEmpty(userName) || not #strings.isEmpty(userPhone)}" th:href="@{/buy/userLogout}">退出登录</a>
            <!--<a th:if="${not #strings.isEmpty(userName)}" href="http://localhost:9003/user/toLogin">退出登录</a>-->
            <!--<a th:if="${not #strings.isEmpty(userPhone)}" href="http://localhost:9003/user/toLogin">退出登录</a>-->
        </div>
    </div>
</header>
<!--查询的条件表单-->
<div class="crumbs-search" id="bread">
    <form>
        <div class="crumbs">
            <a href="#">西瓜二手车</a>&gt;天津二手车
        </div>
        <div class="search js-search">
            <div class="search-box suggestion_widget autocomplete" data-default-count="9">
                <input type="text" id="usedCarName" name="usedCarName" class="search-input js_search_input_index"
                       placeholder="搜索您想要的车">
                <button class="search-btn" type="button" onclick="buySearch(1)"></button>
                <input type="hidden" value="tj" name="hiddenCity">
                <div class="autocomplete-dropdown"></div>
            </div>
        </div>
        <!--分页隐藏域-->
        <input type="hidden" id="page" name="cpage">
        <!--品牌隐藏域-->
        <input type="hidden" id="brandId" name="brandId">
        <!--车系隐藏域-->
        <input type="hidden" id="seriesId" name="seriesId">
        <!--价格隐藏域-->
        <input type="hidden" id="pricePre" name="pricePre">
        <input type="hidden" id="priceEnd" name="priceEnd">
        <!--车龄隐藏域-->
        <input type="hidden" id="carYearPre" name="carYearPre">
        <input type="hidden" id="carYearEnd" name="carYearEnd">
        <!--变速箱隐藏域-->
        <input type="hidden" id="carGearbox" name="carGearbox">
        <!--车型隐藏域-->
        <input type="hidden" id="carType" name="carType">
        <!--里程隐藏域-->
        <input type="hidden" id="carMileage" name="carMileage">
        <!--排量隐藏域-->
        <input type="hidden" id="carDisplacementPre" name="carDisplacementPre">
        <input type="hidden" id="carDisplacementEnd" name="carDisplacementEnd">
        <!--座位隐藏域-->
        <input type="hidden" id="carSeatNumber" name="carSeatNumber">
        <!--燃料类型隐藏域-->
        <input type="hidden" id="carEnergy" name="carEnergy">
    </form>
</div>
<!--展示的查询条件-->
<div class="list-wrap">
    <input type="hidden" id="transmitBrandId" th:value="${transmitBrandId}">
    <input type="hidden" id="transmitSeriesId" th:value="${transmitSeriesId}">
    <input type="hidden" id="transmitPriceId" th:value="${transmitPriceId}">
    <div class="screen">
        <!-- 品牌 -->
        <dl class="clearfix">
            <dt>品牌</dt>
            <dd>
                <div class="dd-top">
                    <span class="a-box1">
                        <!-- 不限 -->
                        <a class="active" id="0b" style="cursor: pointer;" onclick="setBrand(0)">不限</a>
                        <!-- 品牌 -->
                        <!--当传递的-->
                        <span th:each="brand:${brandList}">
                            <a style="cursor: pointer;" th:id="${brand.brandId}+b" th:text="${brand.brandName}"
                               th:onclick="|setBrand(${brand.brandId})|"></a>
                        </span>
                    </span>
                </div>
            </dd>
        </dl>
        <!-- 车系 -->
        <dl class="clearfix">
            <dt>车系</dt>
            <dd>
                <div class="dd-top">
                    <span class="a-box2">
                        <!-- 不限 -->
                        <a class="active" id="0s" style="cursor: pointer;" onclick="setSeries(0)">不限</a>
                        <!-- 车系 -->
                        <span th:each="series:${seriesList}">
                            <a style="cursor: pointer;" th:id="${series.seriesId}+s"
                               th:text="${series.seriesName}" th:onclick="|setSeries(${series.seriesId})|">
                            </a>
                        </span>
                    </span>
                </div>
                <div class="dd-car js-tag js-option-hid-info" style="display: none;">
                    <ul>
                    </ul>
                </div>
            </dd>
        </dl>
        <!-- 价格 -->
        <dl class="clearfix">
            <dt>价格</dt>
            <dd>
                <div class="dd-top">
                        <span class="a-box3">
                                <!-- 不限 -->
                                <a class="active" id="0p" style="cursor: pointer;" onclick="setPrice(0)">不限</a>
                            <!-- 价格 -->
                                <a id="1p" style="cursor: pointer;" onclick="setPrice(1)">5万以下</a>
                                <a id="2p" style="cursor: pointer;" onclick="setPrice(2)">5-10万</a>
                                <a id="3p" style="cursor: pointer;" onclick="setPrice(3)">10-15万</a>
                                <a id="4p" style="cursor: pointer;" onclick="setPrice(4)">15-20万</a>
                         </span>
                    <div class="rangeFilter">
                        <input id="minPrice" type="text" value="" class="screen-price" size="4"
                               onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                        -
                        <input id="maxPrice" type="text" value="" class="screen-price js-end" size="4"
                               onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                        <b style="color: #888">万</b>
                        <button id="priceCar" class="price-btn js-btn" onclick="setPrice(5)">确定</button>
                    </div>
                </div>
            </dd>
        </dl>
        <!-- 更多 -->
        <dl class="clearfix js-more">
            <dt>更多</dt>
            <dd>
                <ul class="dd-more ">
                    <!--车龄-->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            车龄
                        </p>
                        <div class="dd-option">
                            <a onclick="setCarYear(0)">不限</a>
                            <a onclick="setCarYear(1)">1年以内</a>
                            <a onclick="setCarYear(2)">3年以内</a>
                            <a onclick="setCarYear(3)">5年以内</a>
                            <a onclick="setCarYear(4)">5年以上</a>
                        </div>
                    </li>
                    <!-- 变速箱 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            变速箱 </p>
                        <div class="dd-option">
                            <a onclick="setGearbox(0)">不限</a>
                            <a onclick="setGearbox(1)">手动</a>
                            <a onclick="setGearbox(2)">自动</a>
                        </div>
                    </li>
                    <!-- 车型 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            车型 </p>
                        <div class="dd-option">
                            <!-- 不限 -->
                            <a onclick="setCarType(0)">不限</a>
                            <!-- 车型 -->
                            <span th:each="type:${typeList}">
                                <a th:text="${type.typeName}" th:onclick="|setCarType(${type.typeId})|"></a>
                            </span>
                        </div>
                    </li>
                    <!-- 里程 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            里程 </p>
                        <div class="dd-option">
                            <a onclick="setCarMileage(0.0)">不限</a>
                            <a onclick="setCarMileage(1.0)">1万公里内</a>
                            <a onclick="setCarMileage(3.0)">3万公里内</a>
                            <a onclick="setCarMileage(5.0)">5万公里内</a>
                            <a onclick="setCarMileage(6.0)">5万公里以上</a>
                        </div>
                    </li>
                    <!-- 排量 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            排量 </p>
                        <div class="dd-option">
                            <a onclick="setCarDisplacement(0.0,0.0)">不限</a>
                            <a onclick="setCarDisplacement(0.0,1.0)">1.0L以下</a>
                            <a onclick="setCarDisplacement(1.0,1.6)">1.0-1.6L</a>
                            <a onclick="setCarDisplacement(1.6,2.0)">1.6-2.0L</a>
                            <a onclick="setCarDisplacement(2.0,3.0)">2.0-3.0L</a>
                            <a onclick="setCarDisplacement(3.0,0.0)">3.0L以上</a>
                        </div>
                    </li>
                    <!-- 座位数 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            座位数 </p>
                        <div class="dd-option">
                            <a onclick="setCarSeat(0)">不限</a>
                            <a onclick="setCarSeat(2)">2座</a>
                            <a onclick="setCarSeat(4)">4座</a>
                            <a onclick="setCarSeat(5)">5座</a>
                            <a onclick="setCarSeat(6)">6座</a>
                            <a onclick="setCarSeat(7)">7座及以上</a>
                        </div>
                    </li>
                    <!-- 燃油类型 -->
                    <li class="js-hover">
                        <p class="dd-sel"><i></i>
                            燃油类型 </p>
                        <div class="dd-option">
                            <a onclick="setCarEnergy(0)">不限</a>
                            <a onclick="setCarEnergy(1)">汽油</a>
                            <a onclick="setCarEnergy(2)">柴油</a>
                            <a onclick="setCarEnergy(3)">电动</a>
                            <a onclick="setCarEnergy(4)">油电混合</a>
                            <a onclick="setCarEnergy(5)">其他</a>
                        </div>
                    </li>
                </ul>
            </dd>
        </dl>
    </div>
</div>
<!--排序条件-->
<!--<div class="list-filter">
    <div class="list-tab">
        <a class="active">全部</a>
    </div>
    <div class="list-sort">
        <a class="sort-a ">里程<i class=""></i></a>
        <a class="sort-a ">价格<i class=""></i></a>
        <a class="sort-a ">最新发布</a>
    </div>
</div>-->
<!--车辆列表分页-->
<div id="showUsedCar"></div>
<!--底部信息展示-->
<div class="footer">
    <!--加载footer 信息部分 -->
    <div class="company-info clearfix">
        <div class="footer-logo"></div>
        <div class="phone-email">
            <p>
                咨询电话：<i>400-060-6046</i> <br>
                <span>（周一至周日 8:00-21:00）</span>
            </p>
            <p>
                售后服务专线：<i>400-066-8780</i> <br>
                <span>（周一至周日 9:00-21:00）</span>
            </p>
        </div>
        <img src="../img/footer1.png" alt="" class="gz-ewm">
        <p class="ewm-tit">关注微信</p>
        <img src="../img/footer2.png" alt="" class="gz-ewm">
        <p class="ewm-tit">下载APP</p>
        <div class="basic-info">
            <div class="info-link">
                <a rel="nofollow" href="###aboutus/" target="_blank">关于瓜子</a>
                <a rel="nofollow" href="###" target="_blank">加入我们</a>
                <a rel="nofollow" href="###" target="_blank">联系我们</a>
                <a rel="nofollow" href="###" target="_blank">服务保障</a>
            </div>
            <p class="arc-info">Copyright 2017 www.guazi.com All Rights Reserved</p>
            <p class="arc-info">京ICP备15053955号 ICP证151071号 </p>
            <div class="protect clearfix">
                <a class="police" rel="nofollow" target="_blank" href="#">京公网安备11010802020161号</a>
            </div>
            <div class="protect protect-icon-xin315 clearfix">
                <a id="___szfw_logo___" href="#" class="icon-xin" target="_blank"></a>
                <a id="___szfw_logo___1" href="#" class="icon-315" target="_blank"></a>
            </div>
        </div>
    </div>
    <!--seo 链接 -->

    <div class="friendly-link">
        <p class="link-tit">热门品牌：</p>
        <span class="open-box"></span>
        <span class="close-box" data-role="is_show_box"></span>
        <a href="###/" target="_blank">天津二手大众</a>
        <a href="###/" target="_blank">天津二手丰田</a>
        <a href="###/" target="_blank">天津二手福特</a>
        <a href="###/" target="_blank">天津二手奔驰</a>
        <a href="###/" target="_blank">天津二手宝马</a>
        <a href="###/" target="_blank">天津二手奥迪</a>
        <a href="###/" target="_blank">天津二手别克</a>
        <a href="###/" target="_blank">天津二手现代</a>
        <a href="###/" target="_blank">天津二手日产</a>
        <a href="###/" target="_blank">天津二手起亚</a>
        <a href="###/" target="_blank">天津二手比亚迪</a>
        <a href="###/" target="_blank">天津二手标致</a>
        <a href="###/" target="_blank">天津二手本田</a>
        <a href="###/" target="_blank">天津二手雪佛兰</a>
        <a href="###/" target="_blank">天津二手雪铁龙</a>
        <a href="###/" target="_blank">天津二手哈弗</a>
        <a href="###/" target="_blank">天津二手吉利</a>
        <a href="###-/" target="_blank">天津二手夏利</a>
        <a href="###/" target="_blank">天津二手长安</a>
        <a href="###-/" target="_blank">天津二手一汽</a>
        <a href="###/" target="_blank">天津二手奇瑞</a>
        <a href="###/" target="_blank">天津二手长城</a>
        <a href="###/" target="_blank">天津二手五菱</a>
        <a href="###/" target="_blank">天津二手路虎</a>
        <a href="###/" target="_blank">天津二手马自达</a>
        <a href="###/" target="_blank">天津二手斯柯达</a>
        <a href="###/" target="_blank">天津二手江淮</a>
        <a href="###/" target="_blank">天津二手保时捷</a>
        <a href="###/" target="_blank">天津二手MINI</a>
        <a href="###/" target="_blank">天津二手众泰</a>
        <a href="###/" target="_blank">天津二手海马</a>
        <a href="###/" target="_blank">天津二手传祺</a>
        <a href="###/" target="_blank">天津二手铃木</a>
        <a href="###/" target="_blank">天津二手MG</a>
        <a href="###/" target="_blank">天津二手沃尔沃</a>
    </div>
    <div class="friendly-link">
        <p class="link-tit">热门车系：</p>
        <span class="open-box"></span>
        <span class="close-box" data-role="is_show_box"></span>
        <a href="###/" target="_blank">天津二手大众速腾</a>
        <a href="####/" target="_blank">天津二手大众宝来</a>
        <a href="###/" target="_blank">天津二手大众迈腾</a>
        <a href="### /" target="_blank">天津二手大众朗逸</a>
        <a href="### /" target="_blank">天津二手大众高尔夫</a>
        <a href="### /" target="_blank">天津二手大众途观</a>
        <a href="### - /" target="_blank">天津二手大众大众PO...</a>
        <a href="### /" target="_blank">天津二手大众捷达</a>
        <a href="### - /" target="_blank">天津二手福特福克斯</a>
        <a href="### /" target="_blank">天津二手哈弗哈弗H6</a>
        <a href="### /" target="_blank">天津二手丰田卡罗拉</a>
        <a href="### - /" target="_blank">天津二手丰田普拉多</a>
        <a href="### /" target="_blank">天津二手丰田威驰</a>
        <a href="### /" target="_blank">天津二手丰田凯美瑞</a>
        <a href="#####" target="_blank">天津二手夏利夏利</a>
        <a href="###" target="_blank">天津二手宝马宝马3系</a>
        <a href="####" target="_blank">天津二手宝马宝马5系</a>
        <a href="###" target="_blank">天津二手奥迪奥迪A6...</a>
        <a href="###" target="_blank">天津二手奥迪奥迪A4...</a>
        <a href="###" target="_blank">天津二手奥迪奥迪Q5</a>
        <a href="###" target="_blank">天津二手别克凯越</a>
        <a href="#####" target="_blank">天津二手别克君威</a>
        <a href="####" target="_blank">天津二手别克君越</a>
        <a href="#####" target="_blank">天津二手雪铁龙世嘉</a>
        <a href="####" target="_blank">天津二手雪佛兰科鲁兹</a>
        <a href="####" target="_blank">天津二手雪佛兰赛欧</a>
        <a href="####" target="_blank">天津二手奔驰奔驰C级</a>
        <a href="####" target="_blank">天津二手奔驰奔驰E级</a>
        <a href="####" target="_blank">天津二手日产轩逸</a>
        <a href="####" target="_blank">天津二手日产天籁</a>
        <a href="####" target="_blank">天津二手标致标致20...</a>
        <a href="####" target="_blank">天津二手比亚迪秦</a>
        <a href="####" target="_blank">天津二手本田本田CR...</a>
        <a href="###" target="_blank">天津二手起亚智跑</a>
        <a href="####" target="_blank">天津二手现代现代ix...</a>
    </div>
    <div class="friendly-link">
        <p class="link-tit">友情链接：</p>
        <span class="open-box"></span>
        <span class="close-box" data-role="is_show_box"></span>
        <a href="###">天津厂房出租</a>
        <a href="###">天津学车</a>
        <a href="###">天津二手车</a>
        <a href="###">天津百姓网</a>
        <a href="###">天津天气预报15天</a>
        <a href="###">天津信息网</a>
        <a href="###">天津二手车</a>
        <a href="###">天津车市</a>
        <a href="###">天津二手车</a>
        <a href="###">天津房产网</a>
        <a href="###">天津建材网</a>
        <a href="###">天津二手车</a>
        <a href="###">天津车展</a>
        <a href="###">天津汽车网</a>
        <a href="###">天津二手车</a>
        <a href="###">天津汽车网</a>
        <a href="###">天津汽车陪练</a>
        <a href="###">天津信息港</a>
        <a href="###">搜狐汽车天津站</a>
        <a href="###">天津二手车</a>
        <a href="###">天津二手设备回收</a>
        <a href="###">天津二手车</a>
        <a href="###">天津地图</a>
        <a href="###">天津汽车网</a>
        <a href="###">天津分类信息</a>
        <a href="###">天津汽车票</a>
        <a href="###">高速路况查询</a>
    </div>

    <div class="friendly-link">
        <p class="link-tit">热门城市：</p>
        <span class="open-box"></span>
        <span class="close-box" data-role="is_show_box"></span>
        <a href="##">全国二手车</a>
        <a href="##">郑州二手车</a>
        <a href="##">上海二手车</a>
        <a href="##">沈阳二手车</a>
        <a href="##">昆明二手车</a>
        <a href="##">北京二手车</a>
        <a href="##">南宁二手车</a>
        <a href="##">长春二手车</a>
        <a href="##">成都二手车</a>
        <a href="###">天津二手车</a>
        <a href="##">广州二手车</a>
        <a href="##">重庆二手车</a>
        <a href="##">东莞二手车</a>
        <a href="##">大连二手车</a>
        <a href="##">石家庄二手车</a>
        <a href="##">杭州二手车</a>
        <a href="##">兰州二手车</a>
        <a href="##">青岛二手车</a>
        <a href="##">西安二手车</a>
        <a href="##">宁波二手车</a>
        <a href="##">济南二手车</a>
        <a href="##">深圳二手车</a>
        <a href="##">贵阳二手车</a>
        <a href="##">唐山二手车</a>
        <a href="##">哈尔滨二手车</a>
        <a href="##">苏州二手车</a>
        <a href="##">武汉二手车</a>
        <a href="##">佛山二手车</a>
        <a href="##">福州二手车</a>
        <a href="##">南京二手车</a>
        <a href="#">长沙二手车</a>
        <a href="#">二手车</a>
    </div>


    <div class="friendly-link">
        <p class="link-tit">移动版：</p>
        <a href="###">瓜子二手车天津移动页</a>
    </div>

    <div class="friendly-link">
        <p class="link-tit">热门页面：</p>
        <span class="open-box"></span>
        <span class="close-box" data-role="is_show_box"></span>
        <a href="#">1万元二手车</a>
        <a href="#">2万左右二手车</a>
        <a href="#">3万的二手车</a>
        <a href="#">4万的二手车</a>
        <a href="#">5万以下二手车</a>
        <a href="#">二手越野车</a>
        <a href="#">二手商务车</a>
        <a href="#">二手跑车</a>
        <a href="#">自动挡二手车</a>
        <a href="#">急卖二手车</a>
        <a href="#">低价出售二手车</a>
        <a href="#">二手车评估</a>
        <a href="#">二手车分期付款</a>
        <a href="#">二手豪华车</a>
        <a href="#">二手柴油越野车</a>
        <a href="#">7座二手车</a>
        <a href="#">便宜二手奥迪</a>
        <a href="#">柴油二手车</a>
        <a href="#">二手电动汽车</a>
        <a href="#">最新二手车</a>
        <a href="#">买卖二手车</a>
        <a href="#">二手七座商务车</a>
        <a href="#">全国二手车</a>
        <a href="#">天津二手车交易网</a>
        <a href="#">网站地图</a>
    </div>


    <!--公司信息-->
    <p style="text-align:center;line-height:20px;font-size:12px;color:#666; padding-top:20px;">
        车好多旧机动车经纪（北京）有限公司   
        北京市丰台区南四环中路260号北京新发地汽车交易市场旧车经营区B区178号   
        010-57317000
    </p>
</div>
</body>
<script>

    //座位数
    function setCarEnergy(energyNumber) {
        $("#carEnergy").val(energyNumber);
        buySearch(1);
    }

    //座位数
    function setCarSeat(seatNum) {
        $("#carSeatNumber").val(seatNum);
        buySearch(1);
    }

    //排量
    function setCarDisplacement(disPre,disEnd) {
        $("#carDisplacementPre").val(disPre);
        $("#carDisplacementEnd").val(disEnd);
        buySearch(1);
    }

    //里程
    function setCarMileage(mid) {
        $("#carMileage").val(mid);
        buySearch(1);
    }

    //车型
    function setCarType(tid) {
        $("#carType").val(tid);
        buySearch(1);
    }

    //变速箱
    function setGearbox(gid) {
        $("#carGearbox").val(gid);
        buySearch(1);
    }

    //计算车龄
    function setCarYear(yid) {
        var date = new Date();
        if (yid === 0) {
            $("#carYearPre").val('');
            $("#carYearEnd").val('');
        } else if (yid === 1) {
            //一年之内传递一个区间
            $("#carYearPre").val(getCarDate(date.getFullYear() - 1));
            $("#carYearEnd").val(getCarDate(date.getFullYear()));
        } else if (yid === 2) {
            $("#carYearPre").val(getCarDate(date.getFullYear() - 3));
            $("#carYearEnd").val(getCarDate(date.getFullYear()));
        } else if (yid === 3) {
            $("#carYearPre").val(getCarDate(date.getFullYear() - 5));
            $("#carYearEnd").val(getCarDate(date.getFullYear()));
        } else if (yid === 4) {
            $("#carYearPre").val('');
            $("#carYearEnd").val(getCarDate(date.getFullYear() - 5));
        }
        buySearch(1);
    }

    //获取当前年月日
    function getCarDate(year) {
        var date = new Date();
        var sign = "-";
        var month = date.getMonth() + 1; // 月
        var day = date.getDate(); // 日
        // 给一位数数据前面加 “0”
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (day >= 0 && day <= 9) {
            day = "0" + day;
        }
        var currentdate = year + sign + month + sign + day;
        return currentdate;
    }

    var clearBrandId = "0b";
    var clearSeriesId = "0s";
    var clearPriceId = "0p";
    var transmitBrandId = $("#transmitBrandId").val();
    var transmitSeriesId = $("#transmitSeriesId").val();
    var transmitPriceId = $("#transmitPriceId").val();

    $(function () {
        console.log(transmitBrandId);
        console.log(transmitSeriesId);
        console.log("transmitPriceId="+transmitPriceId);
        if (transmitBrandId!=0){
            setBrand(transmitBrandId);
        }else if(transmitSeriesId!=0){
            setSeries(transmitSeriesId);
        }else if (transmitPriceId!=0){
            setPrice(transmitPriceId);
        }else {
            buySearch(1);
        }
    });

    function buySearch(cpage) {
        $("#page").val(cpage);
        $.ajax({
            url: "/buy/buySearchUsedCar",
            type: "post",
            dataType: "html",
            data: $("form").serialize(),
            success: function (data) {
                $("#showUsedCar").html(data);
            }, error: function () {
                alert("查询失败");
            }
        })
    }

    //品牌
    function setBrand(bid) {
        //点击先变换背景
        var brandId = bid + 'b';
        $("#" + brandId).addClass("active");
        //现将传入的id传给clearBrandId装备删除
        if (clearBrandId != brandId) {
            this.clearBrandClass(brandId)
        }
        $("#brandId").val(bid);
        buySearch(1);
    }

    function clearBrandClass(brandId) {
        $("#" + clearBrandId).removeClass("active");
        clearBrandId = brandId;
    }

    //车系
    function setSeries(sid) {
        var seriesId = sid + 's';
        $("#" + seriesId).addClass("active");
        if (clearSeriesId != seriesId) {
            this.clearSeriesClass(seriesId)
        }
        $("#seriesId").val(sid);
        buySearch(1);
    }

    function clearSeriesClass(seriesId) {
        $("#" + clearSeriesId).removeClass("active");
        clearSeriesId = seriesId;
    }

    //价格
    function setPrice(pid) {
        var priceId = pid + 'p';
        $("#" + priceId).addClass("active");
        if (clearPriceId != priceId) {
            this.clearPriceClass(priceId)
        }
        //根据传入的id进行判断给隐藏域赋值
        if (pid == 0) {
            $("#pricePre").val('');
            $("#priceEnd").val('');
        } else if (pid == 1) {
            $("#priceEnd").val(5);
        } else if (pid == 2) {
            $("#pricePre").val(5);
            $("#priceEnd").val(10);
        } else if (pid == 3) {
            $("#pricePre").val(10);
            $("#priceEnd").val(15);
        } else if (pid == 4) {
            $("#pricePre").val(15);
            $("#priceEnd").val(20);
        } else if (pid == 5) {
            var minPrice = $("#minPrice").val();
            var maxPrice = $("#maxPrice").val();
            $("#pricePre").val(minPrice);
            $("#priceEnd").val(maxPrice);
        }
        buySearch(1);
    }

    function clearPriceClass(priceId) {
        $("#" + clearPriceId).removeClass("active");
        clearPriceId = priceId;
    }
</script>
</html>